package com.usooft.metaTalent.db.teach;

import com.usooft.framework.core.query.Page;
import com.usooft.framework.web.auth.RequiresPermission;
import com.usooft.metaTalent.core.teach.service.CourseService;
import com.usooft.metaTalent.core.teach.wrapper.CourseWrapper;
import com.usooft.metaTalent.db.teach.form.CourseListForm;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/teach/course")
@RequiredArgsConstructor
public class CourseController {
    private final CourseService courseService;

    @GetMapping("/list")
    @RequiresPermission(
            value = "/teach/course/list",
            description = "课程/查询"
    )
    public ResponseEntity<?> list(CourseListForm form) {
        Page<CourseWrapper> page = courseService.page(form.buildQuery());
        return ResponseEntity.ok(page);
    }
}
